<!DOCTYPE html>
<html class="client-nojs vector-feature-night-mode-disabled vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-sticky-header-enabled" lang="en" dir="ltr"><head>
<meta charset="UTF-8">
<title>This (computer programming)</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://en.wikipedia.org/wiki/This_(computer_programming)"> <link href="./mw/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/ext.pygments.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/user.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./mw/site.styles.css">
<link rel="stylesheet" type="text/css" href="./mw/noscript.css">
<link rel="stylesheet" type="text/css" href="./footer.css">
<link rel="stylesheet" type="text/css" href="./vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-This_computer_programming rootpage-This_computer_programming skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">
<span id="openzim-page-title" class="mw-page-title-main">this (computer programming)</span>
</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr">
<p><b>this</b>, <b>self</b>, and <b>Me</b> are <a href="Reserved_word" title="Reserved word">keywords</a> used in some computer <a href="Programming_language" title="Programming language">programming languages</a> to refer to the object, class, or other entity which the currently running code is a part of. The entity referred to thus depends on the <a href="Execution_context" class="mw-redirect" title="Execution context">execution context</a> (such as which object has its method called). Different programming languages use these keywords in slightly different ways. In languages where a keyword like "this" is mandatory, the keyword is the only way to access data and methods stored in the current object. Where optional, these keywords can disambiguate variables and functions with the same name.
</p>
<meta property="mw:PageProp/toc">
<div class="mw-heading mw-heading2"><h2 id="Object-oriented_programming">Object-oriented programming</h2></div>
<p>In many <a href="Object-oriented_programming" title="Object-oriented programming">object-oriented</a> <a href="Programming_language" title="Programming language">programming languages</a>, <code>this</code> (also called <code>self</code> or <code>Me</code>) is a variable that is used in <a href="Instance_method" class="mw-redirect" title="Instance method">instance methods</a> to refer to the object on which they are working. The first OO language, <a href="Simula" title="Simula">SIMULA 67</a>, used <code>this</code> to explicitly reference the local object.<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup><sup class="reference nowrap"><span title="Page / location: 4.3.2.3">: 4.3.2.3 </span></sup> <a href="C%2B%2B" title="C++">C++</a> and languages which derive in style from it (such as <a href="Java_(programming_language)" title="Java (programming language)">Java</a>, <a href="C_Sharp_(programming_language)" title="C Sharp (programming language)">C#</a>, <a href="D_(programming_language)" title="D (programming language)">D</a>, and <a href="PHP" title="PHP">PHP</a>) also generally use <code>this</code>. <a href="Smalltalk" title="Smalltalk">Smalltalk</a> and others, such as <a href="Object_Pascal" title="Object Pascal">Object Pascal</a>, <a href="Perl" title="Perl">Perl</a>, <a href="Python_(programming_language)" title="Python (programming language)">Python</a>, <a href="Ruby_(programming_language)" title="Ruby (programming language)">Ruby</a>, <a href="Rust_(programming_language)" title="Rust (programming language)">Rust</a>, <a href="Objective-C" title="Objective-C">Objective-C</a>, <a href="DataFlex" title="DataFlex">DataFlex</a> and <a href="Swift_(programming_language)" title="Swift (programming language)">Swift</a>, use <code>self</code>. Microsoft's <a href="Visual_Basic" title="Visual Basic">Visual Basic</a> uses <code>Me</code>.
</p><p>The concept is similar in all languages: <code>this</code> is usually an immutable <a href="Reference_(computer_science)" title="Reference (computer science)">reference</a> or <a href="Pointer_(computer_programming)" title="Pointer (computer programming)">pointer</a> which refers to the current object; the current object often being the code that acts as 'parent' or 'invocant' to the <a href="Property_(programming)" title="Property (programming)">property</a>, <a href="Method_(computer_programming)" title="Method (computer programming)">method</a>, sub-routine or function that contains the <code>this</code> keyword. After an object is properly constructed, or instantiated, <code>this</code> is always a valid reference. Some languages require it explicitly; others use <a href="Lexical_scoping" class="mw-redirect" title="Lexical scoping">lexical scoping</a> to use it implicitly to make symbols within their class visible. Or alternatively, the current object referred to by <code>this</code> may be an independent code object that has called the function or method containing the keyword <code>this</code>. Such a thing happens, for example, when a <a href="JavaScript" title="JavaScript">JavaScript</a> event handler attached to an HTML tag in a web page calls a function containing the keyword <code>this</code> stored in the global space outside the document object; in that context, <code>this</code> will refer to the page element within the document object, not the enclosing window object.<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup>
</p><p>In some languages, for example C++, Java, and Raku <code>this</code> or <code>self</code> is a <a href="Keyword_(computer_programming)" class="mw-redirect" title="Keyword (computer programming)">keyword</a>, and the variable automatically exists in instance methods. In others, for example, Python, Rust, and Perl 5, the first <a href="Parameter_(computer_programming)" title="Parameter (computer programming)">parameter</a> of an instance method is such a reference. It needs to be specified explicitly. In Python and Perl, the parameter need not necessarily be named <code>this</code> or <code>self</code>; it can be named freely by the programmer like any other parameter. However, by informal convention, the first parameter of an instance method in Perl or Python is named <code>self</code>. Rust requires the self object to be called <code>&self</code> or <code>self</code>, depending on whether the invoked function borrows the invocant, or moves it in, respectively.
</p><p><a href="Static_method" class="mw-redirect" title="Static method">Static methods</a> in C++ or Java are not associated with instances but classes, and so cannot use <code>this</code>, because there is no object. In other languages, such as Ruby, Smalltalk, Objective-C, or Swift, the method is associated with a <i>class object</i> that is passed as <code>this</code>, and they are called <a href="Class_method" class="mw-redirect" title="Class method">class methods</a>. For class methods, Python uses <code>cls</code> to access to the <i>class object</i>.
</p>
<div class="mw-heading mw-heading2"><h2 id="Subtleties_and_difficulties">Subtleties and difficulties</h2></div>
<p>When lexical scoping is used to infer <code>this</code>, the use of <code>this</code> in code, while not illegal, may raise warning bells to a maintenance programmer, although there are still legitimate uses of <code>this</code> in this case, such as referring to instance variables hidden by local variables of the same name, or if the method wants to return a reference to the current object, i.e. <code>this</code>, itself.
</p><p>In some compilers (for example <a href="GNU_Compiler_Collection" title="GNU Compiler Collection">GCC</a>), pointers to C++ instance methods can be directly cast to a pointer of another type, with an explicit <code>this</code> pointer parameter.<sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading3"><h3 id="Open_recursion">Open recursion</h3></div>
<p>The dispatch semantics of <code>this</code>, namely that method calls on <code>this</code> are dynamically dispatched, is known as <b>open recursion</b>, and means that these methods can be <a href="Method_overriding" title="Method overriding">overridden</a> by derived classes or objects. By contrast, direct named recursion or <a href="Anonymous_recursion" title="Anonymous recursion">anonymous recursion</a> of a function uses <b>closed recursion</b>, with static dispatch. For example, in the following <a href="Perl" title="Perl">Perl</a> code for the factorial, the token <code>__SUB__</code> is a reference to the current function:
</p>
<div class="mw-highlight mw-highlight-lang-perl mw-content-ltr" dir="ltr"><pre><span class="k">use</span><span class="w"> </span><span class="nn">feature</span><span class="w"> </span><span class="s">":5.16"</span><span class="p">;</span>
<span class="k">sub</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="k">my</span><span class="w"> </span><span class="nv">$x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">shift</span><span class="p">;</span>
<span class="w"> </span><span class="nv">$x</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="mi">0</span><span class="w"> </span><span class="p">?</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="nv">$x</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="nn">__SUB__</span><span class="o">-></span><span class="p">(</span><span class="w"> </span><span class="nv">$x</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="p">);</span>
<span class="p">}</span>
</pre></div>
<p>By contrast, in C++ (using an explicit <code>this</code> for clarity, though not necessary) the <code>this</code> binds to the object itself, but if the class method was declared "virtual" i.e. polymorphic in the base, it's resolved via dynamic dispatch so that derived classes can override it.
</p>
<div class="mw-highlight mw-highlight-lang-cpp mw-content-ltr" dir="ltr"><pre><span class="kt">unsigned</span><span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="nf">factorial</span><span class="p">(</span><span class="kt">unsigned</span><span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">n</span><span class="p">)</span>
<span class="p">{</span>
<span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">n</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="mi">0</span><span class="p">)</span>
<span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="mi">1</span><span class="p">;</span>
<span class="w"> </span><span class="k">else</span>
<span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">n</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">this</span><span class="o">-></span><span class="n">factorial</span><span class="p">(</span><span class="n">n</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="mi">1</span><span class="p">);</span>
<span class="p">}</span>
</pre></div>
<p>This example is artificial since this is direct recursion, so overriding the <code>factorial</code> method would override this function; more natural examples are when a method in a derived class calls the same method in a base class, or in cases of mutual recursion.<sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-5" class="reference"><a href="#cite_note-5"><span class="cite-bracket">[</span>5<span class="cite-bracket">]</span></a></sup>
</p><p>The <a href="Fragile_base_class" title="Fragile base class">fragile base class</a> problem has been blamed on open recursion, with the suggestion that invoking methods on <code>this</code> default to closed recursion (static dispatch) rather than open recursion (dynamic dispatch), only using open recursion when it is specifically requested; external calls (not using <code>this</code>) would be dynamically dispatched as usual.<sup id="cite_ref-6" class="reference"><a href="#cite_note-6"><span class="cite-bracket">[</span>6<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-7" class="reference"><a href="#cite_note-7"><span class="cite-bracket">[</span>7<span class="cite-bracket">]</span></a></sup> The way this is solved in practice in the JDK is through a certain programmer discipline; this discipline has been formalized by C. Ruby and G. T. Leavens; it consists of the following rules:<sup id="cite_ref-JDK_8-0" class="reference"><a href="#cite_note-JDK-8"><span class="cite-bracket">[</span>8<span class="cite-bracket">]</span></a></sup>
</p>
<ul><li>No code invokes <code>public</code> methods on <code>this</code>.</li>
<li>Code that can be reused internally (by invocation from other methods of the same class) is encapsulated in a <code>protected</code> or <code>private</code> method; if it needs to be exposed directly to the users as well, then a wrapper <code>public</code> method calls the internal method.</li>
<li>The previous recommendation can be relaxed for <a href="Pure_function" title="Pure function">pure</a> methods.</li></ul>
<div class="mw-heading mw-heading2"><h2 id="Implementations">Implementations</h2></div>
<div class="mw-heading mw-heading3"><h3 id="C++">C++</h3></div>
<style data-mw-deduplicate="TemplateStyles:r1236090951">
/* start https://en.wikipedia.org/ */
.mw-parser-output .hatnote{font-style:italic}.mw-parser-output div.hatnote{padding-left:1.6em;margin-bottom:0.5em}.mw-parser-output .hatnote i{font-style:normal}.mw-parser-output .hatnote+link+.hatnote{margin-top:-0.5em}@media print{body.ns-0 .mw-parser-output .hatnote{display:none!important}}
/* end https://en.wikipedia.org/ */
</style><div role="note" class="hatnote navigation-not-searchable">Further information: <a href="C%2B%2B_classes" title="C++ classes">C++ classes</a></div>
<p>Early versions of C++ would let the <code>this</code> pointer be changed; by doing so a programmer could change which object a method was working on. This feature was eventually removed, and now <code>this</code> in C++ is an <a href="Value_(computer_science)#Assignment:_l-values_and_r-values" title="Value (computer science)">r-value</a>.<sup id="cite_ref-C++03_9-0" class="reference"><a href="#cite_note-C++03-9"><span class="cite-bracket">[</span>9<span class="cite-bracket">]</span></a></sup>
</p><p>Early versions of C++ did not include references and it has been suggested that had they been so in <a href="C%2B%2B" title="C++">C++</a> from the beginning, <code>this</code> would have been a reference, not a pointer.<sup id="cite_ref-10" class="reference"><a href="#cite_note-10"><span class="cite-bracket">[</span>10<span class="cite-bracket">]</span></a></sup>
</p><p>C++ lets objects destroy themselves with the source code statement: <code>delete this</code>.
</p>
<div class="mw-heading mw-heading3"><h3 id="C#">C#</h3></div>
<div role="note" class="hatnote navigation-not-searchable">Further information: <a href="C_Sharp_(programming_language)" title="C Sharp (programming language)">C Sharp (programming language)</a></div>
<p>The keyword <code>this</code> in <a href="C_Sharp_(programming_language)" title="C Sharp (programming language)">C#</a> works the same way as in Java, for reference types. However, within C# <a href="Value_type" class="mw-redirect" title="Value type">value types</a>, <code>this</code> has quite different semantics, being similar to an ordinary mutable variable reference, and can even occur on the left side of an assignment.
</p><p>One use of <code>this</code> in C# is to allow reference to an outer field variable within a method that contains a local variable that has the same name. In such a situation, for example, the statement <code>var n = localAndFieldname;</code> within the method will assign the type and value of the local variable <code>localAndFieldname</code> to <code>n</code>, whereas the statement <code>var n = this.localAndFieldname;</code> will assign the type and value of the outer field variable to <code>n</code>.<sup id="cite_ref-11" class="reference"><a href="#cite_note-11"><span class="cite-bracket">[</span>11<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading3"><h3 id="D">D</h3></div>
<p>In <a href="D_(programming_language)" title="D (programming language)">D</a> <code>this</code> in a class, struct, or union method refers to an immutable reference of the instance of the enclosing aggregate. Classes are <a href="Reference_type" class="mw-redirect" title="Reference type">reference</a> types, and structs and unions are value types. In the first version of D, the keyword <code>this</code> is used as a pointer to the instance of the object the method is bound to, while in D2 it has the character of an implicit <a href="Call_by_reference" class="mw-redirect" title="Call by reference"><code>ref</code></a> function argument.
</p>
<div class="mw-heading mw-heading3"><h3 id="Dylan">Dylan</h3></div>
<p>In the programming language <a href="Dylan_(programming_language)" title="Dylan (programming language)">Dylan</a>, which is an object-oriented language that supports <a href="Multimethod" class="mw-redirect" title="Multimethod">multimethods</a> and doesn't have a concept of <code>this</code>, sending a message to an object is still kept in the syntax. The two forms below work in the same way; the differences are just <a href="Syntactic_sugar" title="Syntactic sugar">syntactic sugar</a>.
</p>
<pre>object.method(param1, param2)
</pre>
<p>and
</p>
<pre>method (object, param1, param2)
</pre>
<div class="mw-heading mw-heading3"><h3 id="Eiffel">Eiffel</h3></div>
<p>Within a class text, the <b>current type</b> is the type obtained from the <b>current class</b>. Within features (routines, commands and queries) of a class, one may use the keyword <code>Current</code> to reference the current class and its features. The use of the keyword <code>Current</code> is optional as the keyword <code>Current</code> is implied by simply referring to the name of the current class feature openly. For example: One might have a feature `foo' in a class MY_CLASS and refer to it by:
</p>
<div class="mw-highlight mw-highlight-lang-eiffel mw-content-ltr mw-highlight-lines" dir="ltr"><pre><span class="w"> </span><span class="kr">class</span>
<span class="w"> </span><span class="nc">MY_CLASS</span>
<span class="w"> </span>
<span class="w"> </span><span class="kr">feature</span><span class="w"> </span><span class="c1">-- Access</span>
<span class="w"> </span>
<span class="w"> </span><span class="n">foo</span><span class="p">:</span><span class="w"> </span><span class="nc">INTEGER</span>
<span class="w"> </span>
<span class="w"> </span><span class="n">my_function</span><span class="p">:</span><span class="w"> </span><span class="nc">INTEGER</span>
<span class="w"> </span><span class="kr">do</span>
<span class="hll"><span class="w"> </span><span class="kc">Result</span><span class="w"> </span><span class="o">:=</span><span class="w"> </span><span class="n">foo</span>
</span><span class="w"> </span><span class="kr">end</span>
<span class="w"> </span>
<span class="w"> </span><span class="kr">end</span>
</pre></div><p><sup id="cite_ref-12" class="reference"><a href="#cite_note-12"><span class="cite-bracket">[</span>12<span class="cite-bracket">]</span></a></sup>
</p><p>Line #10 (above) has the implied reference to <code>Current</code> by the call to simple `foo'.
</p><p>Line #10 (below) has the explicit reference to <code>Current</code> by the call to `Current.foo'.
</p>
<div class="mw-highlight mw-highlight-lang-eiffel mw-content-ltr mw-highlight-lines" dir="ltr"><pre><span class="w"> </span><span class="kr">class</span>
<span class="w"> </span><span class="nc">MY_CLASS</span>
<span class="w"> </span>
<span class="w"> </span><span class="kr">feature</span><span class="w"> </span><span class="c1">-- Access</span>
<span class="w"> </span>
<span class="w"> </span><span class="n">foo</span><span class="p">:</span><span class="w"> </span><span class="nc">INTEGER</span>
<span class="w"> </span>
<span class="w"> </span><span class="n">my_function</span><span class="p">:</span><span class="w"> </span><span class="nc">INTEGER</span>
<span class="w"> </span><span class="kr">do</span>
<span class="hll"><span class="w"> </span><span class="kc">Result</span><span class="w"> </span><span class="o">:=</span><span class="w"> </span><span class="kc">Current</span><span class="p">.</span><span class="n">foo</span>
</span><span class="w"> </span><span class="kr">end</span>
<span class="w"> </span>
<span class="w"> </span><span class="kr">end</span>
</pre></div>
<p>Either approach is acceptable to the compiler, but the implied version (e.g. <code>x := foo</code>) is preferred as it is less verbose.
</p><p>As with other languages, there are times when the use of the keyword <code>Current</code> is mandated, such as:
</p>
<div class="mw-highlight mw-highlight-lang-eiffel mw-content-ltr mw-highlight-lines" dir="ltr"><pre><span class="w"> </span><span class="kr">class</span>
<span class="w"> </span><span class="nc">MY_CLASS</span>
<span class="w"> </span>
<span class="w"> </span><span class="kr">feature</span><span class="w"> </span><span class="c1">-- Access</span>
<span class="w"> </span>
<span class="w"> </span><span class="n">my_command</span>
<span class="w"> </span><span class="c1">-- Create MY_OTHER_CLASS with `Current'</span>
<span class="w"> </span><span class="kr">local</span>
<span class="w"> </span><span class="n">x</span><span class="p">:</span><span class="w"> </span><span class="nc">MY_OTHER_CLASS</span>
<span class="w"> </span><span class="kr">do</span>
<span class="hll"><span class="w"> </span><span class="kr">create</span><span class="w"> </span><span class="n">x</span><span class="p">.</span><span class="n">make_with_something</span><span class="w"> </span><span class="p">(</span><span class="kc">Current</span><span class="p">)</span>
</span><span class="w"> </span><span class="kr">end</span>
<span class="w"> </span>
<span class="w"> </span><span class="kr">end</span>
</pre></div>
<p>In the case of the code above, the call on line #11 to <b>make_with_something</b> is passing the current class by explicitly passing the keyword <code>Current</code>.
</p>
<div class="mw-heading mw-heading3"><h3 id="Java">Java</h3></div>
<div role="note" class="hatnote navigation-not-searchable">Further information: <a href="Java_(programming_language)" title="Java (programming language)">Java (programming language)</a></div>
<p>The keyword <code>this</code> is a <a href="Java_(programming_language)" title="Java (programming language)">Java</a> language keyword that represents the current instance of the class in which it appears. It is used to access class variables and methods.
</p><p>Since all instance methods are virtual in Java, <code>this</code> can never be null.<sup id="cite_ref-13" class="reference"><a href="#cite_note-13"><span class="cite-bracket">[</span>13<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading3"><h3 id="JavaScript">JavaScript</h3></div>
<div role="note" class="hatnote navigation-not-searchable">Further information: <a href="JavaScript" title="JavaScript">JavaScript</a></div>
<p>In JavaScript, which is a programming or <a href="Scripting_language" title="Scripting language">scripting language</a> used extensively in web browsers, <code>this</code> is an important keyword, although what it evaluates to depends on where it is used.
</p>
<ul><li>When used outside any function, in global space, <code>this</code> refers to the enclosing object, which in this case is the enclosing browser window, the <code>window</code> object.</li>
<li>When used in a function defined in the global space, what the keyword <code>this</code> refers to depends on how the function is called. When such a function is called directly (e.g. <code>f(x)</code>), <code>this</code> will refer back to the global space in which the function is defined, and in which other global functions and variables may exist as well (or in strict mode, it is <code>undefined</code>). If a global function containing <code>this</code> is called as part of the event handler of an element in the document object, however, <code>this</code> will refer to the calling HTML element.</li>
<li>When a method is called using the <code>new</code> keyword (e.g. <code>var c = new Thing()</code>) then within Thing <code>this</code> refers to the Thing object itself.</li>
<li>When a function is attached as a property of an object and called as a method of that object (e.g. <code>obj.f(x)</code>), <code>this</code> will refer to the object that the function is contained within.<sup id="cite_ref-14" class="reference"><a href="#cite_note-14"><span class="cite-bracket">[</span>14<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-15" class="reference"><a href="#cite_note-15"><span class="cite-bracket">[</span>15<span class="cite-bracket">]</span></a></sup> It is even possible to manually specify <code>this</code> when calling a function, by using the <code>.call()</code> or <code>.apply()</code> methods of the function object.<sup id="cite_ref-16" class="reference"><a href="#cite_note-16"><span class="cite-bracket">[</span>16<span class="cite-bracket">]</span></a></sup> For example, the method call <code>obj.f(x)</code> could also be written as <code>obj.f.call(obj, x)</code>.</li></ul>
<p>To work around the different meaning of <code>this</code> in nested functions such as DOM event handlers, it is a common idiom in JavaScript to save the <code>this</code> reference of the calling object in a variable (commonly called <code>that</code> or <code>self</code>), and then use the variable to refer to the calling object in nested functions.
</p><p>For example:
</p>
<div class="mw-highlight mw-highlight-lang-javascript mw-content-ltr" dir="ltr"><pre><span class="c1">// In this example $ is a reference to the jQuery library </span>
<span class="nx">$</span><span class="p">(</span><span class="s2">".element"</span><span class="p">).</span><span class="nx">hover</span><span class="p">(</span><span class="kd">function</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="c1">// Here, both this and that point to the element under the mouse cursor.</span>
<span class="w"> </span><span class="kd">var</span><span class="w"> </span><span class="nx">that</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">this</span><span class="p">;</span>
<span class="w"> </span>
<span class="w"> </span><span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">).</span><span class="nx">find</span><span class="p">(</span><span class="s1">'.elements'</span><span class="p">).</span><span class="nx">each</span><span class="p">(</span><span class="kd">function</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="c1">// Here, this points to the DOM element being iterated.</span>
<span class="w"> </span><span class="c1">// However, that still points to the element under the mouse cursor.</span>
<span class="w"> </span><span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">).</span><span class="nx">addClass</span><span class="p">(</span><span class="s2">"highlight"</span><span class="p">);</span>
<span class="w"> </span><span class="p">});</span>
<span class="p">});</span>
</pre></div>
<p>Notably, JavaScript makes use of both <code>this</code> and the related keyword <code>self</code><sup id="cite_ref-17" class="reference"><a href="#cite_note-17"><span class="cite-bracket">[</span>17<span class="cite-bracket">]</span></a></sup> (in contrast to most other languages which tend to employ one or the other), with <code>self</code> being restricted specifically to web workers.<sup id="cite_ref-18" class="reference"><a href="#cite_note-18"><span class="cite-bracket">[</span>18<span class="cite-bracket">]</span></a></sup>
</p><p>Finally, as a reliable way of specifically referencing the global (window or equivalent) object, JavaScript features the <code>globalThis</code> keyword.<sup id="cite_ref-19" class="reference"><a href="#cite_note-19"><span class="cite-bracket">[</span>19<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading3"><h3 id="Lua">Lua</h3></div>
<div role="note" class="hatnote navigation-not-searchable">Further information: <a href="Lua_(programming_language)" class="mw-redirect" title="Lua (programming language)">Lua (programming language)</a></div>
<p>In Lua, <code>self</code> is created as <a href="Syntactic_sugar" title="Syntactic sugar">syntactic sugar</a> when functions are defined using the <code>:</code> operator.<sup id="cite_ref-20" class="reference"><a href="#cite_note-20"><span class="cite-bracket">[</span>20<span class="cite-bracket">]</span></a></sup> When invoking a method using <code>:</code>, the object being indexed will be implicitly given as the first argument to the function being invoked.
</p><p>For example, the following two functions are equivalent:
</p>
<div class="mw-highlight mw-highlight-lang-lua mw-content-ltr" dir="ltr"><pre><span class="kd">local</span><span class="w"> </span><span class="nv">obj</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{}</span>
<span class="kr">function</span><span class="w"> </span><span class="nc">obj</span><span class="p">.</span><span class="nf">foo</span><span class="p">(</span><span class="nv">arg1</span><span class="p">,</span><span class="w"> </span><span class="nv">arg2</span><span class="p">)</span>
<span class="w"> </span><span class="nb">print</span><span class="p">(</span><span class="nv">arg1</span><span class="p">,</span><span class="w"> </span><span class="nv">arg2</span><span class="p">)</span><span class="w"> </span><span class="c1">-- cannot use "self" here</span>
<span class="kr">end</span>
<span class="kr">function</span><span class="w"> </span><span class="nc">obj</span><span class="p">:</span><span class="nf">bar</span><span class="p">(</span><span class="nv">arg</span><span class="p">)</span>
<span class="w"> </span><span class="nb">print</span><span class="p">(</span><span class="nv">self</span><span class="p">,</span><span class="w"> </span><span class="nv">arg</span><span class="p">)</span><span class="w"> </span><span class="c1">-- "self" is an implicit first argument before arg</span>
<span class="kr">end</span>
<span class="c1">-- All functions can be invoked both ways, with "." or with ":"</span>
<span class="nv">obj</span><span class="p">:</span><span class="nf">foo</span><span class="p">(</span><span class="s2">"Foo"</span><span class="p">)</span><span class="w"> </span><span class="c1">-- equivalent to obj.foo(obj, "Foo")</span>
<span class="nv">obj</span><span class="p">.</span><span class="nf">bar</span><span class="p">(</span><span class="nv">obj</span><span class="p">,</span><span class="w"> </span><span class="s2">"Bar"</span><span class="p">)</span><span class="w"> </span><span class="c1">-- equivalent to obj:bar("Bar")</span>
</pre></div>
<p>Lua itself is not object-oriented, but when combined with another feature called metatables, the use of <code>self</code> lets programmers define functions in a manner resembling object-oriented programming.
</p>
<div class="mw-heading mw-heading3"><h3 id="PowerShell">PowerShell</h3></div>
<p>In PowerShell, the special <a href="Automatic_variable" title="Automatic variable">automatic variable</a> <code>$_</code> contains the current object in the pipeline object. You can use this variable in commands that perform an action on every object or on selected objects in a pipeline.<sup id="cite_ref-21" class="reference"><a href="#cite_note-21"><span class="cite-bracket">[</span>21<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-highlight mw-highlight-lang-ps1 mw-content-ltr" dir="ltr"><pre><span class="s2">"one"</span><span class="p">,</span> <span class="s2">"two"</span><span class="p">,</span> <span class="s2">"three"</span> <span class="p">|</span> <span class="p">%</span> <span class="p">{</span> <span class="nb">write </span><span class="nv">$_</span> <span class="p">}</span>
</pre></div><p>Also starting with PowerShell 5.0, which adds a formal syntax to define classes and other user-defined types,<sup id="cite_ref-22" class="reference"><a href="#cite_note-22"><span class="cite-bracket">[</span>22<span class="cite-bracket">]</span></a></sup> <code>$this</code> variable describes the current instance of the object.
</p><div class="mw-heading mw-heading3"><h3 id="Python">Python</h3></div>
<p>In Python, there is no keyword for <code>this</code>. When a member function is called on an object, it invokes the member function with the same name on the object's class object, with the object automatically bound to the first argument of the function. Thus, the obligatory first parameter of <a href="Method_(computer_programming)" title="Method (computer programming)">instance methods</a> serves as <code>this</code>; this parameter is conventionally named <code>self</code>, but can be named anything.
</p><p>In class methods (created with the <code>classmethod</code> decorator), the first argument refers to the class object itself, and is conventionally called <code>cls</code>; these are primarily used for inheritable constructors,<sup id="cite_ref-23" class="reference"><a href="#cite_note-23"><span class="cite-bracket">[</span>23<span class="cite-bracket">]</span></a></sup> where the use of the class as a parameter allows subclassing the constructor. In static methods (created with the <code>staticmethod</code> decorator), no special first argument exists.
</p>
<div class="mw-heading mw-heading3"><h3 id="Rust">Rust</h3></div>
<p>In Rust, types are declared separately from the functions associated with them. Functions designed to be analogous to instance methods in more traditionally object-oriented languages must explicitly take <code>self</code> as their first parameter. These functions can then be called using <code>instance.method()</code> syntax sugar. For example:
</p>
<div class="mw-highlight mw-highlight-lang-rust mw-content-ltr" dir="ltr"><pre><span class="k">struct</span><span class="w"> </span><span class="nc">Foo</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="n">bar</span><span class="p">:</span><span class="w"> </span><span class="kt">i32</span><span class="p">,</span>
<span class="p">}</span>
<span class="k">impl</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="k">fn</span><span class="w"> </span><span class="nf">new</span><span class="p">()</span><span class="w"> </span><span class="p">-></span><span class="w"> </span><span class="nc">Foo</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">bar</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="p">}</span>
<span class="w"> </span><span class="p">}</span>
<span class="w"> </span><span class="k">fn</span><span class="w"> </span><span class="nf">refer</span><span class="p">(</span><span class="o">&</span><span class="bp">self</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="fm">println!</span><span class="p">(</span><span class="s">"{}"</span><span class="p">,</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">bar</span><span class="p">);</span>
<span class="w"> </span><span class="p">}</span>
<span class="w"> </span><span class="k">fn</span><span class="w"> </span><span class="nf">mutate</span><span class="p">(</span><span class="o">&</span><span class="k">mut</span><span class="w"> </span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">baz</span><span class="p">:</span><span class="w"> </span><span class="kt">i32</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">bar</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">baz</span><span class="p">;</span>
<span class="w"> </span><span class="p">}</span>
<span class="w"> </span><span class="k">fn</span><span class="w"> </span><span class="nf">consume</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">refer</span><span class="p">();</span>
<span class="w"> </span><span class="p">}</span>
<span class="p">}</span>
</pre></div>
<p>This defines a type, <code>Foo</code>, which has four associated functions. The first, <code>Foo::new()</code>, is not an instance function and must be specified with the type prefix. The remaining three all take a <code>self</code> parameter in a variety of ways and can be called on a <code>Foo</code> instance using the dot-notation syntax sugar, which is equivalent to calling the type-qualified function name with an explicit <code>self</code> first parameter.
</p>
<div class="mw-highlight mw-highlight-lang-rust mw-content-ltr" dir="ltr"><pre><span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">foo</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Foo</span><span class="p">::</span><span class="n">new</span><span class="p">();</span><span class="w"> </span><span class="c1">// must called as a type-specified function</span>
<span class="n">foo</span><span class="p">.</span><span class="n">refer</span><span class="p">();</span><span class="w"> </span><span class="c1">// prints "0". Foo::refer() has read-only access to the foo instance</span>
<span class="n">foo</span><span class="p">.</span><span class="n">mutate</span><span class="p">(</span><span class="mi">5</span><span class="p">);</span><span class="w"> </span><span class="c1">// mutates foo in place, permitted by the &mut specification, need foo to be declared mut</span>
<span class="n">foo</span><span class="p">.</span><span class="n">consume</span><span class="p">();</span><span class="w"> </span><span class="c1">// prints "5" and destroys foo, as Foo::consume() takes full ownership of self</span>
<span class="c1">// equivalent to foo.refer()</span>
<span class="n">Foo</span><span class="p">::</span><span class="n">refer</span><span class="p">(</span><span class="n">foo</span><span class="p">);</span><span class="w"> </span><span class="c1">// compilation error: foo is out of scope</span>
</pre></div>
<div class="mw-heading mw-heading3"><h3 id="Self">Self</h3></div>
<p>The <a href="Self_(programming_language)" title="Self (programming language)">Self</a> language is named after this use of "self".
</p>
<div class="mw-heading mw-heading3"><h3 id="Xbase++">Xbase++</h3></div>
<p><code>Self</code> is strictly used within methods of a class.
Another way to refer to <code>Self</code> is to use <code>::</code>.
</p>
<div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div>
<ul><li><a href="Anonymous_recursion" title="Anonymous recursion">Anonymous recursion</a> – Recursion without calling a function by name</li>
<li><a href="Inheritance_(object-oriented_programming)" title="Inheritance (object-oriented programming)">Inheritance (object-oriented programming)</a> – Process of deriving classes from, and organizing them into, a hierarchy</li>
<li><a href="Self-reference" title="Self-reference">Self-reference</a> – Sentence, idea or formula that refers to itself</li>
<li><a href="Schizophrenia_(object-oriented_programming)" title="Schizophrenia (object-oriented programming)">Schizophrenia (object-oriented programming)</a> – Complication arising from delegation and related techniques in object-oriented programming</li>
<li><a href="Program_Segment_Prefix" title="Program Segment Prefix">Program Segment Prefix</a> – Data structure in DOS</li></ul>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1239543626">
/* start https://en.wikipedia.org/ */
.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}
/* end https://en.wikipedia.org/ */
</style><div class="reflist reflist-columns references-column-width" style="column-width: 30em;">
<ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-1">^</a></b></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">
/* start https://en.wikipedia.org/ */
.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./mw/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./mw/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./mw/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./mw/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}
/* end https://en.wikipedia.org/ */
</style><cite id="CITEREFDahlMyhrhaugNygaard1970" class="citation web cs1"><a href="Ole-Johan_Dahl" title="Ole-Johan Dahl">Dahl, Ole-Johan</a>; Myhrhaug, Bjørn; <a href="Kristen_Nygaard" title="Kristen Nygaard">Nygaard, Kristen</a> (1970). <a rel="nofollow" class="external text" href="http://www.edelweb.fr/Simula/#7">"Common Base Language, Norwegian Computing Center"</a>.</cite></span>
</li>
<li id="cite_note-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-2">^</a></b></span> <span class="reference-text">Powell, Thomas A, and Schneider, Fritz, 2012. <i>JavaScript: The Complete Reference, Third Edition.</i> McGraw-Hill. Chapter 11, <i>Event Handling</i>, p 428. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <bdi>978-0-07-174120-0</bdi></span>
</li>
<li id="cite_note-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-3">^</a></b></span> <span class="reference-text">Using the GNU Compiler Collection (GCC) – <a rel="nofollow" class="external text" href="https://gcc.gnu.org/onlinedocs/gcc/Bound-member-functions.html">Bound member functions</a></span>
</li>
<li id="cite_note-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-4">^</a></b></span> <span class="reference-text">"<a rel="nofollow" class="external text" href="http://www.cs.ox.ac.uk/people/ralf.hinze/talks/Open.pdf">Closed and Open Recursion</a>", <a rel="nofollow" class="external text" href="http://www.informatik.uni-bonn.de/~ralf">Ralf Hinze</a>, July 2007</span>
</li>
<li id="cite_note-5"><span class="mw-cite-backlink"><b><a href="#cite_ref-5">^</a></b></span> <span class="reference-text"><a rel="nofollow" class="external text" href="http://lambda-the-ultimate.org/node/3204">Open Recursion</a>, <i><a rel="nofollow" class="external text" href="http://lambda-the-ultimate.org/">Lambda the Ultimate</a></i></span>
</li>
<li id="cite_note-6"><span class="mw-cite-backlink"><b><a href="#cite_ref-6">^</a></b></span> <span class="reference-text">"<a rel="nofollow" class="external text" href="https://www.cs.cmu.edu/~aldrich/papers/selective-open-recursion.pdf">Selective Open Recursion: A Solution to the Fragile Base Class Problem</a>", Jonathan Aldrich</span>
</li>
<li id="cite_note-7"><span class="mw-cite-backlink"><b><a href="#cite_ref-7">^</a></b></span> <span class="reference-text">"<a rel="nofollow" class="external text" href="http://lambda-the-ultimate.org/classic/message12271.html">Selective Open Recursion: A Solution to the Fragile Base Class Problem</a>", <i><a rel="nofollow" class="external text" href="http://lambda-the-ultimate.org/">Lambda the Ultimate</a></i></span>
</li>
<li id="cite_note-JDK-8"><span class="mw-cite-backlink"><b><a href="#cite_ref-JDK_8-0">^</a></b></span> <span class="reference-text">Aldrich, Jonathan, and Kevin Donnelly. "<a rel="nofollow" class="external text" href="https://www.cs.cmu.edu/~aldrich/papers/savcbs04.pdf">Selective open recursion: Modular reasoning about components and inheritance.</a>" SAVCBS 2004 Specification and Verification of Component-Based Systems (2004): 26. citing for the JDK-adopted solution C. Ruby and G. T. Leavens. "Safely Creating Correct Subclasses without Seeing Superclass Code". In Object-Oriented Programming Systems, Languages, and Applications, October 2000. <a href="Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1145%2F353171.353186">10.1145/353171.353186</a> also available as <a rel="nofollow" class="external text" href="http://www.eecs.ucf.edu/~leavens/tech-reports/ISU/TR00-05/TR.pdf">technical report TR #00-05d</a></span>
</li>
<li id="cite_note-C++03-9"><span class="mw-cite-backlink"><b><a href="#cite_ref-C++03_9-0">^</a></b></span> <span class="reference-text"><cite class="citation book cs1"><i>ISO/IEC 14882:2003(E): Programming Languages - C++</i>. ISO/IEC. 2003.</cite></span>
</li>
<li id="cite_note-10"><span class="mw-cite-backlink"><b><a href="#cite_ref-10">^</a></b></span> <span class="reference-text">Stroustrup: <a rel="nofollow" class="external text" href="http://www.stroustrup.com/bs_faq2.html#this">C++ Style and Technique FAQ</a></span>
</li>
<li id="cite_note-11"><span class="mw-cite-backlink"><b><a href="#cite_ref-11">^</a></b></span> <span class="reference-text">De Smet, Bart, 2011. <i>C# 4.0 Unleashed.</i> Sams Publishing, Indianapolis, USA. Chapter 4, <i>Language Essentials</i>, p 210. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <bdi>978-0-672-33079-7</bdi></span>
</li>
<li id="cite_note-12"><span class="mw-cite-backlink"><b><a href="#cite_ref-12">^</a></b></span> <span class="reference-text">NOTE: The line numbers are for reference purposes only. Eiffel does not have line numbers in the class text. However, there is a line number option in the Eiffel Studio IDE, which can be optionally turned on for reference purposes (e.g. pair programming, etc).</span>
</li>
<li id="cite_note-13"><span class="mw-cite-backlink"><b><a href="#cite_ref-13">^</a></b></span> <span class="reference-text">Barnes, D. and Kölling, M. <i>Objects First with Java</i>. "...the reason for using this construct [this] is that we have a situation that is known as <b>name overloading</b> - the same name being used for two different entities... It is important to understand that the fields and the parameters are separate variables that exist independently of each other, even though they share similar names. A parameter and a field sharing a name is not a problem in Java."</span>
</li>
<li id="cite_note-14"><span class="mw-cite-backlink"><b><a href="#cite_ref-14">^</a></b></span> <span class="reference-text">Crockford, Douglas, 2008. <i>JavaScript: The Good Parts</i>. O'Reilly Media Inc. and Yahoo! Inc. Chapter 4, <i>Functions</i>, p 28. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <bdi>978-0-596-51774-8</bdi></span>
</li>
<li id="cite_note-15"><span class="mw-cite-backlink"><b><a href="#cite_ref-15">^</a></b></span> <span class="reference-text">Powell, Thomas A, and Schneider, Fritz, 2012. <i>JavaScript: The Complete Reference, Third Edition.</i> McGraw-Hill. Chapter 5, <i>Functions</i>, pp 170–1. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <bdi>978-0-07-174120-0</bdi></span>
</li>
<li id="cite_note-16"><span class="mw-cite-backlink"><b><a href="#cite_ref-16">^</a></b></span> <span class="reference-text">Goodman, Danny, with Morrison, Michael, 2004. <i>JavaScript Bible, 5th Edition.</i> Wiley Publishing, Inc., Indianapolis, USA. Chapter 33, <i>Functions and Custom Objects</i>, p 987. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <bdi>0-7645-5743-2</bdi></span>
</li>
<li id="cite_note-17"><span class="mw-cite-backlink"><b><a href="#cite_ref-17">^</a></b></span> <span class="reference-text"><a rel="nofollow" class="external text" href="https://developer.mozilla.org/en-US/docs/Web/API/Window/self"><i>Mozilla Developer Network</i>: Window.self</a></span>
</li>
<li id="cite_note-18"><span class="mw-cite-backlink"><b><a href="#cite_ref-18">^</a></b></span> <span class="reference-text"><a rel="nofollow" class="external text" href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API"><i>Mozilla Developer Network</i>: Web Worker API</a></span>
</li>
<li id="cite_note-19"><span class="mw-cite-backlink"><b><a href="#cite_ref-19">^</a></b></span> <span class="reference-text"><a rel="nofollow" class="external text" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis"><i>Mozilla Developer Network</i>: globalThis</a></span>
</li>
<li id="cite_note-20"><span class="mw-cite-backlink"><b><a href="#cite_ref-20">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://www.lua.org/pil/16.html">"Programming in Lua : 16"</a>.</cite></span>
</li>
<li id="cite_note-21"><span class="mw-cite-backlink"><b><a href="#cite_ref-21">^</a></b></span> <span class="reference-text"><cite id="CITEREFmsdn" class="citation web cs1">msdn. <a rel="nofollow" class="external text" href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_automatic_variables">"PowerShell: About Automatic Variables"</a>. <i>docs.microsoft.com</i><span class="reference-accessdate">. Retrieved <span class="nowrap">2018-03-22</span></span>.</cite></span>
</li>
<li id="cite_note-22"><span class="mw-cite-backlink"><b><a href="#cite_ref-22">^</a></b></span> <span class="reference-text"><cite id="CITEREFmsdn" class="citation web cs1">msdn. <a rel="nofollow" class="external text" href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_classes">"about_Classes"</a>. <i>docs.microsoft.com</i><span class="reference-accessdate">. Retrieved <span class="nowrap">2018-12-17</span></span>.</cite></span>
</li>
<li id="cite_note-23"><span class="mw-cite-backlink"><b><a href="#cite_ref-23">^</a></b></span> <span class="reference-text"><i>Unifying types and classes in Python 2.2,</i> Guido van Rossum, "<a rel="nofollow" class="external text" href="https://www.python.org/download/releases/2.2.3/descrintro/#__new__">Overriding the __new__ method</a>"</span>
</li>
</ol></div>
<div class="mw-heading mw-heading2"><h2 id="Further_reading">Further reading</h2></div>
<ul><li>Meyers, Scott, 1995. <i>More Effective C++: 35 New Ways to Improve Your Programs and Designs</i>. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <bdi>0-201-63371-X</bdi> <a href="Scott_Meyers" title="Scott Meyers">Scott Meyers</a></li>
<li>Stroustrup, Bjarne, 1994. <i>The Design and Evolution of C++</i>. Addison-Wesley Pub. Co. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <bdi>0-201-54330-3</bdi> <a href="Bjarne_Stroustrup" title="Bjarne Stroustrup">Bjarne Stroustrup</a></li></ul></div><!--htdig_noindex--><div><div class="zim-footer">
This article is issued from <a class="external text" title="Last edited on 2024-09-05" href="https://en.wikipedia.org/wiki/?title=This_(computer_programming)&oldid=1244205255">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>
</body></html>